package com.ecust.ml.grid.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 转换概率
 * @author pleasebugme
 *
 */
public class TransitionProbability {

	/**
	 * 目标单元格序号
	 * <index, index>
	 */
	private Map<Integer, Integer> gridCellIndexes;
	
	/**
	 * 目标单元格概率值
	 * <index, probability>
	 */
	private Map<Integer, Float> gridCellProbability;

	public TransitionProbability() {
		this.gridCellIndexes = new HashMap<Integer, Integer>();
		this.gridCellProbability = new HashMap<Integer, Float>();
	}
	
	/**
	 * 增加某个索引单元格的概率值
	 * @param index
	 * @param p
	 */
	public void addIndexProbability(int index, float p) {
		if(this.gridCellIndexes.containsKey(index)) {
			this.gridCellProbability.put(index, this.gridCellProbability.get(index) + p);
		} else {
			this.gridCellIndexes.put(index, index);
			this.gridCellProbability.put(index, p);
		}
	}

	public Map<Integer, Integer> getGridCellIndexes() {
		return gridCellIndexes;
	}

	public void setGridCellIndexes(Map<Integer, Integer> gridCellIndexes) {
		this.gridCellIndexes = gridCellIndexes;
	}

	public Map<Integer, Float> getGridCellProbability() {
		return gridCellProbability;
	}

	public void setGridCellProbability(Map<Integer, Float> gridCellProbability) {
		this.gridCellProbability = gridCellProbability;
	}
	
	
}
